package logic;

import org.junit.*;

import affd.logic.Token;
import affd.logic.Token.Type;
import static org.junit.Assert.*;

public class TokenTest {
	
	public Token testToken;
	
	@Before
	public void initializeTokenTest() {
		testToken = new Token("Heikki", Type.WORD);
	}

	@Test 
	public void test_modifyContent() {
		testToken.modifyContent("Xxx A", "name", "group0");
		assertEquals("Xxx A", testToken.getContent());
		assertEquals("Heikki", testToken.getOriginal());
		assertNotNull(testToken.getTag());
		assertNotNull(testToken.getTag().getAttribute("id"));
		assertEquals("name", testToken.getTag().getAttribute("class"));
		assertEquals("group0", testToken.getTag().getAttribute("group"));
	}
	
	@Test 
	public void test_uncertainContent() {
		testToken.uncertainContent("name", "group0");
		assertEquals("Heikki", testToken.getContent());
		assertEquals("Heikki", testToken.getOriginal());
		assertNotNull(testToken.getTag());
		assertNotNull(testToken.getTag().getAttribute("id"));
		assertNotNull(testToken.getTag().getAttribute("uncertain"));
		assertEquals("yes", testToken.getTag().getAttribute("uncertain"));
		assertEquals("name", testToken.getTag().getAttribute("class"));
		assertEquals("group0", testToken.getTag().getAttribute("group"));
	}
	
}
